package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.zhentao.pojo.OtherInboundItem;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 调拨单主表
 * @TableName transfer_order
 */
@TableName(value ="transfer_order")
@Data
public class TransferOrder implements Serializable {
    /**
     * 主键ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 调拨单编号
     */
    private String transferNo;

    /**
     * 调出仓库ID
     */
    private Long fromWarehouseId;

    /**
     * 调入仓库ID
     */
    private Long toWarehouseId;

    /**
     * 状态
     */
    private Integer status;

    /**
     * 调拨日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date transferDate;

    /**
     * 备注
     */
    private String remark;

    /**
     * 创建人
     */
    @TableField(exist = false)
    private Long createUser;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 租户ID
     */
    private Long tenantId;
    @TableField(exist = false)
    private List<TransferOrderItem> items;
    @TableField(exist = false)
    private String fromWarehouseName;
    @TableField(exist = false)
    private String toWarehouseName;

    /**
     * 其他入库单号，关联其他入库单，表明该调拨业务对应的入库单
     */
    private String inboundNo;

    /**
     * 入库单明细列表，用于创建调拨单时传递数据
     */
    @TableField(exist = false)
    private List<OtherInboundItem> inboundItems;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        TransferOrder other = (TransferOrder) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getTransferNo() == null ? other.getTransferNo() == null : this.getTransferNo().equals(other.getTransferNo()))
            && (this.getFromWarehouseId() == null ? other.getFromWarehouseId() == null : this.getFromWarehouseId().equals(other.getFromWarehouseId()))
            && (this.getToWarehouseId() == null ? other.getToWarehouseId() == null : this.getToWarehouseId().equals(other.getToWarehouseId()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getTransferDate() == null ? other.getTransferDate() == null : this.getTransferDate().equals(other.getTransferDate()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getTenantId() == null ? other.getTenantId() == null : this.getTenantId().equals(other.getTenantId()))
            && (this.getInboundNo() == null ? other.getInboundNo() == null : this.getInboundNo().equals(other.getInboundNo()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getTransferNo() == null) ? 0 : getTransferNo().hashCode());
        result = prime * result + ((getFromWarehouseId() == null) ? 0 : getFromWarehouseId().hashCode());
        result = prime * result + ((getToWarehouseId() == null) ? 0 : getToWarehouseId().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getTransferDate() == null) ? 0 : getTransferDate().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getTenantId() == null) ? 0 : getTenantId().hashCode());
        result = prime * result + ((getInboundNo() == null) ? 0 : getInboundNo().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", transferNo=").append(transferNo);
        sb.append(", fromWarehouseId=").append(fromWarehouseId);
        sb.append(", toWarehouseId=").append(toWarehouseId);
        sb.append(", status=").append(status);
        sb.append(", transferDate=").append(transferDate);
        sb.append(", remark=").append(remark);
        sb.append(", createUser=").append(createUser);
        sb.append(", createTime=").append(createTime);
        sb.append(", tenantId=").append(tenantId);
        sb.append(", inboundNo=").append(inboundNo);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
